package com.example.Repository;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

@Mapper
public interface SignInDataMapper {
    @Select("SELECT " +
            "SUM(CASE WHEN StuMessage = '异常' AND StuTemp > 36.7 THEN 1 ELSE 0 END) AS exceptional, " +
            "SUM(CASE WHEN StuMessage = '迟到' AND NOT (StuMessage = '异常' AND StuTemp > 36.7) THEN 1 ELSE 0 END) AS late, " +
            "SUM(CASE WHEN StuMessage = '缺勤' AND NOT (StuMessage = '异常' AND StuTemp > 36.7) THEN 1 ELSE 0 END) AS absent, " +
            "SUM(CASE WHEN StuMessage = '签到' AND NOT (StuMessage = '异常' AND StuTemp > 36.7) THEN 1 ELSE 0 END) AS present " +
            "FROM signindata")
    Map<String, Integer> getSignInData();
}